<template>
  <el-form-item :label="label" :prop="prop" :rules="rule">
    <el-input v-model="inputVal" @change="upDateValue" />
  </el-form-item>
</template>

<script>
import {
  checkIdCardNumber
} from '@/utils/validate'
export default {
  name: '',
  components: {},
  props: {
    label: {
      type: String,
      default: '身份证号码'
    },
    prop: {
      type: String,
      default: 'idCard'
    },
    value: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      inputVal: '',
      rule: {
        required: true,
        validator: checkIdCardNumber,
        trigger: 'blur'
      }
    }
  },
  created() {
    this.inputVal = this.value
  },
  mounted() {},
  methods: {
    upDateValue(val) {
      this.$emit('update:value', val)
      this.$emit('change', val)
    }
  }
}
</script>

<style lang="less" scoped>

</style>
